package com.saint.lt.dao;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.saint.lt.domain.Issue;

@Repository
public class IssueDAOImpl implements IssueDAO {

	@Autowired
	private SessionFactory sessionFactory;

	@Override
	public void add(Issue issue) {
		sessionFactory.getCurrentSession().save(issue);
	}

	@Override
	public List<Issue> list() {
		List<Issue> issues = sessionFactory.getCurrentSession().createCriteria(Issue.class).list();
		return issues;
	}
	
}
